package fun.xinnix.websocket.controller;

import fun.xinnix.entity.Result;
import fun.xinnix.websocket.domain.SendMessage;
import fun.xinnix.websocket.service.WebsocketUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/message")
public class SocketController {
    @PostMapping("/send")
    public Result sendMessage(@RequestBody SendMessage msg) {
        WebsocketUtils.getInstance().sendMessageMsg(msg);
        return Result.success();
    }
}
